package com.ny.demo515;

import java.util.ArrayList;
import java.util.List;

public class TestList {
    public static void main(String[] args) {
        Emp emp1 = new Emp();
        emp1.setNumber("1002");
        emp1.setName("程咬金");
        emp1.setAge(20);

        Emp emp2 = new Emp();
        emp2.setNumber("1001");
        emp2.setName("李白");
        emp2.setAge(20);

        Emp emp3 = new Emp();
        emp3.setNumber("1003");
        emp3.setName("安琪拉");
        emp3.setAge(20);

        List<Emp> list = new ArrayList();
        list.add(emp1);
        list.add(emp2);
        list.add(emp3);

        for(int i=0;i<list.size();i++){
            System.out.println(list.get(i));
        }
        for(int i=0;i<list.size();i++){
            System.out.println(list.get(i).getName());
        }
        
    }
}
